package com.gcstorage.tvdev.constants;

import java.security.cert.X509Certificate;

import okhttp3.tls.Certificates;
import okhttp3.tls.HandshakeCertificates;

public final class CustomTrust {
    private static final X509Certificate comodoRsaCertificationAuthority = Certificates.decodeCertificatePem(
            "-----BEGIN CERTIFICATE-----\n" +
            "MIIF9TCCBN2gAwIBAgIQAZPJpg0JkG0+F3NZ4F9i6jANBgkqhkiG9w0BAQsFADBu\n" +
            "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" +
            "d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg\n" +
            "RFYgVExTIENBIC0gRzEwHhcNMjIwNDE0MDAwMDAwWhcNMjMwNDE1MjM1OTU5WjAc\n" +
            "MRowGAYDVQQDExFhcHAuZ2NzdG9yYWdlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD\n" +
            "ggEPADCCAQoCggEBAJ1M8VlEcIOIlCyPrONu/fl38fPL6WeJ5+9PhG97EM8SUpQe\n" +
            "iGKuKH1ueG3/7LWkRfpJp44HUj0uQXc0nczryHiz9e5akr3icWg3p4rOXNiw62Ap\n" +
            "vKzwDDfY7dNhMJV5M7dyoVgoMZAkK/KeQAJ7I7fP5eSZGrLUBjc0cVqHg2CrSteb\n" +
            "D6Ex1hYNg21HV6yE36Uznn+SxFuDIWFnFE1JTAB5jARp3ngAQdtIGSS1GoNSWIHN\n" +
            "vvQq00kYZq525r1aadrTLEosNyt5KrlvgJpuc4pWzTN0/fly93SzLsH/Rza1IjNO\n" +
            "9BiP8R1qtvWOvmzT06AeCeNx6VprjpvNpVpVN18CAwEAAaOCAt8wggLbMB8GA1Ud\n" +
            "IwQYMBaAFFV0T7JyT/VgulDR1+ZRXJoBhxrXMB0GA1UdDgQWBBT9ZvJyXCXivPjX\n" +
            "TSKeQddMCotsJzAcBgNVHREEFTATghFhcHAuZ2NzdG9yYWdlLmNvbTAOBgNVHQ8B\n" +
            "Af8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMD4GA1UdIAQ3\n" +
            "MDUwMwYGZ4EMAQIBMCkwJwYIKwYBBQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQu\n" +
            "Y29tL0NQUzCBgAYIKwYBBQUHAQEEdDByMCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz\n" +
            "cC5kaWdpY2VydC5jb20wSgYIKwYBBQUHMAKGPmh0dHA6Ly9jYWNlcnRzLmRpZ2lj\n" +
            "ZXJ0LmNvbS9FbmNyeXB0aW9uRXZlcnl3aGVyZURWVExTQ0EtRzEuY3J0MAkGA1Ud\n" +
            "EwQCMAAwggF8BgorBgEEAdZ5AgQCBIIBbASCAWgBZgB1AK33vvp8/xDIi509nB4+\n" +
            "GGq0Zyldz7EMJMqFhjTr3IKKAAABgCZoML8AAAQDAEYwRAIgChCY9H1FHnZAB64Q\n" +
            "UmVDZeRidGj0ED4gPirwcHmfGokCIE28/9IE4eaUT2/f7BHHXFzKUjDazXYDfjZq\n" +
            "rXYvtggXAHYANc8ZG7+xbFe/D61MbULLu7YnICZR6j/hKu+oA8M71kwAAAGAJmgw\n" +
            "sQAABAMARzBFAiAhCH3I8uha5Ln34T4zljYMl5TVn5sPOu4ZygwwVrYMyAIhAKqW\n" +
            "VKnJM3tGMZyI5J5TiZLeWUc5gheXGxf/HEz4Goj1AHUAtz77JN+cTbp18jnFulj0\n" +
            "bF38Qs96nzXEnh0JgSXttJkAAAGAJmgwrwAABAMARjBEAiA5w+863X3pgW6/p3T/\n" +
            "Jke5y793YSNXpd4NTXXEkWiRHAIgCxdGYn7ZOE7xyr+6PlxRkL0gYKFF5a0w8o3V\n" +
            "2mIJvAkwDQYJKoZIhvcNAQELBQADggEBAK2chyfUbfIjS3n8zdrVS6mzzslmv02Z\n" +
            "rWB3lfaxDok3Kt5qrUaOU2wSMAJRKjvOIyB1IC4PzTM415mj4qYtJX0eFo3icbRK\n" +
            "hZdblROIdAkEfQsjPBBu0T4kK6bZmeG8BOfINwfmorRNfkchmiADiz+Ze7z/keij\n" +
            "SJh0xkiwOsOTVgoRMxyiTFDLHoVX2nfaI0StoG9GtcNwBxUryWkbcOOCRe/9+Unh\n" +
            "nl4z54ARBErAfrttEW2mYJPx6dFLD8R/Nf0wqo892QNifaj+i4gqBep+c58gjAqN\n" +
            "7R+7ccPirqNDNz0VHLJQ4zbk4PAMVugsOSyUV4mAjPpQJhk0U53y1ZI=\n" +
            "-----END CERTIFICATE-----");

    private static final X509Certificate entrustRootCertificateAuthority = Certificates.decodeCertificatePem(
            "-----BEGIN CERTIFICATE-----\n" +
            "MIIEqjCCA5KgAwIBAgIQAnmsRYvBskWr+YBTzSybsTANBgkqhkiG9w0BAQsFADBh\n" +
            "MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" +
            "d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD\n" +
            "QTAeFw0xNzExMjcxMjQ2MTBaFw0yNzExMjcxMjQ2MTBaMG4xCzAJBgNVBAYTAlVT\n" +
            "MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j\n" +
            "b20xLTArBgNVBAMTJEVuY3J5cHRpb24gRXZlcnl3aGVyZSBEViBUTFMgQ0EgLSBH\n" +
            "MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALPeP6wkab41dyQh6mKc\n" +
            "oHqt3jRIxW5MDvf9QyiOR7VfFwK656es0UFiIb74N9pRntzF1UgYzDGu3ppZVMdo\n" +
            "lbxhm6dWS9OK/lFehKNT0OYI9aqk6F+U7cA6jxSC+iDBPXwdF4rs3KRyp3aQn6pj\n" +
            "pp1yr7IB6Y4zv72Ee/PlZ/6rK6InC6WpK0nPVOYR7n9iDuPe1E4IxUMBH/T33+3h\n" +
            "yuH3dvfgiWUOUkjdpMbyxX+XNle5uEIiyBsi4IvbcTCh8ruifCIi5mDXkZrnMT8n\n" +
            "wfYCV6v6kDdXkbgGRLKsR4pucbJtbKqIkUGxuZI2t7pfewKRc5nWecvDBZf3+p1M\n" +
            "pA8CAwEAAaOCAU8wggFLMB0GA1UdDgQWBBRVdE+yck/1YLpQ0dfmUVyaAYca1zAf\n" +
            "BgNVHSMEGDAWgBQD3lA1VtFMu2bwo+IbG8OXsj3RVTAOBgNVHQ8BAf8EBAMCAYYw\n" +
            "HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8C\n" +
            "AQAwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdp\n" +
            "Y2VydC5jb20wQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQu\n" +
            "Y29tL0RpZ2lDZXJ0R2xvYmFsUm9vdENBLmNybDBMBgNVHSAERTBDMDcGCWCGSAGG\n" +
            "/WwBAjAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BT\n" +
            "MAgGBmeBDAECATANBgkqhkiG9w0BAQsFAAOCAQEAK3Gp6/aGq7aBZsxf/oQ+TD/B\n" +
            "SwW3AU4ETK+GQf2kFzYZkby5SFrHdPomunx2HBzViUchGoofGgg7gHW0W3MlQAXW\n" +
            "M0r5LUvStcr82QDWYNPaUy4taCQmyaJ+VB+6wxHstSigOlSNF2a6vg4rgexixeiV\n" +
            "4YSB03Yqp2t3TeZHM9ESfkus74nQyW7pRGezj+TC44xCagCQQOzzNmzEAP2SnCrJ\n" +
            "sNE2DpRVMnL8J6xBRdjmOsC3N6cQuKuRXbzByVBjCqAA8t1L0I+9wXJerLPyErjy\n" +
            "rMKWaBFLmfK/AHNF4ZihwPGOc7w6UHczBZXH5RFzJNnww+WnKuTPI0HfnVH8lg==\n" +
            "-----END CERTIFICATE-----");



    public static HandshakeCertificates getCertificates() {
        return new HandshakeCertificates.Builder()
                .addTrustedCertificate(entrustRootCertificateAuthority)
                .addTrustedCertificate(comodoRsaCertificationAuthority)
                // Uncomment if standard certificates are also required.
                //.addPlatformTrustedCertificates()
                .build();
    }
}
